import { request } from './request'
import { devUrl, proUrl } from './config'
/**
 * 评论相关接口
 */

// 获取当前运行的环境
const env = import.meta.env.MODE
const baseUrl = env === 'development' ? devUrl.baseUrl : proUrl.baseUrl
// 获取评论列表
export function getCommonts(articleId: string) {
  return request.get(baseUrl + `/comment/list/${articleId}`)
}

// 添加评论
export function addCommont(data: any) {
  return request.post(baseUrl + '/comment/add', data)
}

// 删除评论
export function deleteComment(id: string) {
  return request.delete(baseUrl + `/comment/delete/${id}`)
}

// 获取评论数量
export function getCommontCount(articleId: string) {
  return request.get(baseUrl + `/comment/count/${articleId}`)
}
